#include <iostream>
#include <stdlib.h>
#include "File.h"
#include "Record.h"


int main(){
	char *lineItemDbfile="/home/abhijeet/ufl/dbi/db/lineitem.tbl";
	File file;
	
	//Open the database
	file.Open(1, lineItemDbfile );
	
	//page buffer to hold the item
	Page lineItemPage ;
	
	//Get no of pages in the database
	off_t pages = file.GetLength();
	
	//total no of pages
	cout << "Total pages: " << pages ;
	
	Schema schema("catalog", "lineitem");
	
	//Record buffer to hold the each record
	Record record;
	
	int loop;
	for ( loop = 0; loop < pages; loop++) {
		file.GetPage(&lineItemPage,loop);
		while ( lineItemPage.GetFirst(&record)) 
			record.Print(&schema);
	}
	
	file.Close();
	
	return 0;
	
	
}

